

void UI_DlgMove::init() {
    PF_SETTINGS->beginGroup("/Modify");
    copies = PF_SETTINGS->readEntry("/MoveCopies", "10");
    numberMode = PF_SETTINGS->readNumEntry("/MoveMode", 0);
    useCurrentLayer =
        (bool)PF_SETTINGS->readNumEntry("/MoveUseCurrentLayer", 0);
    useCurrentAttributes =
        (bool)PF_SETTINGS->readNumEntry("/MoveUseCurrentAttributes", 0);
    PF_SETTINGS->endGroup();

    switch (numberMode) {
    case 0:
        rbMove->setChecked(true);
        break;
    case 1:
        rbCopy->setChecked(true);
        break;
    case 2:
        rbMultiCopy->setChecked(true);
        break;
    default:
        break;
    }
    leNumber->setText(copies);
    cbCurrentAttributes->setChecked(useCurrentAttributes);
    cbCurrentLayer->setChecked(useCurrentLayer);
}

void UI_DlgMove::destroy() {
    PF_SETTINGS->beginGroup("/Modify");
    PF_SETTINGS->writeEntry("/MoveCopies", leNumber->text());
    if (rbMove->isChecked()) {
        numberMode = 0;
    } else if (rbCopy->isChecked()) {
        numberMode = 1;
    } else {
        numberMode = 2;
    }
    PF_SETTINGS->writeEntry("/MoveMode", numberMode);
    PF_SETTINGS->writeEntry("/MoveUseCurrentLayer",
                            (int)cbCurrentLayer->isChecked());
    PF_SETTINGS->writeEntry("/MoveUseCurrentAttributes",
                            (int)cbCurrentAttributes->isChecked());
    PF_SETTINGS->endGroup();
}

void UI_DlgMove::setData(PF_MoveAttribute* d) {
    data = d;
}

void UI_DlgMove::updateData() {
    if (rbMove->isChecked()) {
        data->number = 0;
    } else if (rbCopy->isChecked()) {
        data->number = 1;
    } else {
        data->number = leNumber->text().toInt();
    }
    data->useCurrentAttributes = cbCurrentAttributes->isChecked();
    data->useCurrentLayer = cbCurrentLayer->isChecked();
}

